package appconfig

import (
	"github.com/spf13/viper"
	"log"
)

type Mysql struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     string
	Password string
}

type SendSms struct {
	AccessKeyId     string
	AccessKeySecret string
	Endpoint        string
}
type Appconfig struct {
	Mysql
	Redis
	SendSms
}

var AppCon Appconfig

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&AppCon)
	log.Println("动态读取配置成功", AppCon)
}
